package com.itheima.jobs;

import com.alibaba.dubbo.config.annotation.Reference;
import com.itheima.service.MsgAdviceJoBService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * 前一天短信通知
 */
@Component
public class MsgAdviceJoB {

    @Reference(version = "1.0.0")
    private MsgAdviceJoBService msgAdviceJoBService;

    public void advice(){
        List<HashMap<String, Object>> list = msgAdviceJoBService.findAdviceUserOnYesterday();
        System.out.println("短信发送提醒用户预约");
        for (HashMap<String, Object> map : list) {
            //map中的内容
            //[{phoneNumber=13593196666, name=大哥哥, orderDate=2021-09-12}, {phoneNumber=13593196547, name=张三, orderDate=2021-09-12}]
            System.out.println("亲爱的"+map.get("name")+"用户，不要忘了您明天在传智健康预约的套餐哦");
            //发送短信即可
        }
    }
}
